package com.linwen.excise.niuke._80;

import java.util.Scanner;

/**
 * @author wlw
 * @date 2023/3/27 11:30 PM
 */
public class _90合法IP {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String ip = scanner.nextLine();
        System.out.println(function(ip));
    }

    private static String function(String ip) {
        if(ip==null||ip.length()==0){
            return "NO";
        }
        String[] split = ip.split("\\.");
        if(split.length!=4){
            return "NO";
        }
        for (int i = 0; i < split.length; i++) {
            try{
                if((split[i].length()>1&&split[i].charAt(0)=='0')||!split[i].matches("[0-9]+")){
                    return "NO";
                }
                Integer integer = Integer.valueOf(split[i]);
                if(integer<0||integer>255){
                    return "NO";
                }
            }catch (Exception e){
                return "NO";
            }

        }
        return "YES";
    }
}
